// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// import echarts  from 'echarts '//引入echarts
import ant from 'ant-design-vue' //引入全部组件
import 'ant-design-vue/dist/antd.css'
import axios from "axios"
Vue.prototype.$ajax = axios;
// Vue.use(echarts)
Vue.config.productionTip = false;
Vue.use(ant);

router.beforeEach((to, from, next) => {
  let name = sessionStorage.getItem('name')
  if (to.path == '/loginPage') {
    if (sessionStorage.name == undefined) {
      next()
    } else {
      next('/')
    }
  } else {
    if (sessionStorage.name == undefined) {
      next('/loginPage')
    } else {
      next()
    }
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {
    App
  },
  template: '<App/>'
});
